﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using ComicIsland.Common.Entities.InterfaceJson;

/**
 * 创建时间：2014/12/30 10:52:44
 * 作者：yong.blackcore
 * Email：itblackhole@outlook.com
 * QQ：50404503
 */
namespace ComicIsland.App.Views.DTSelector
{
    /// <summary>
    /// 我的话题
    /// </summary>
    public class CommunityReviewUserPageTemplateSelector : DataTemplateSelector
    {
        /// <summary>
        /// 讨论区模板
        /// </summary>
        public DataTemplate DiscussionArea { get; set; }

        /// <summary>
        /// 书评区模板
        /// </summary>
        public DataTemplate ReviewArea { get; set; }

        /// <summary>
        /// 根据NewsInf的属性，返回对应的DataTemplate 
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="container"></param>
        /// <returns></returns>

        public override DataTemplate SelectTemplate(object obj, DependencyObject container)
        {

            JsonComicCommunityReviewInfo item = obj as JsonComicCommunityReviewInfo;
            if (item != null)
            {
                if (item.Bigbookid <= 0)
                {
                    return DiscussionArea;
                }
                else
                {
                    return ReviewArea;
                }
            }
            return base.SelectTemplate(item, container);
        }
    }
}
